package edu.uta.components;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.Toast;

import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;
/**
 * @author fall 2011 team5
 */
/*
 * //reference http://about-android.blogspot.com/2010/03/steps-to-place-marker-in-map-overlay.html
*/
public class MapMarker extends BalloonItemizedOverlay<OverlayItem>{

	
	/**
	 * @uml.property  name="m_overlays"
	 * @uml.associationEnd  multiplicity="(0 -1)" elementType="uta.project.components.BalloonOverlayItem"
	 */
	private ArrayList<BalloonOverlayItem> mapoverlays = new ArrayList<BalloonOverlayItem>();
	/**
	 * @uml.property  name="c"
	 * @uml.associationEnd  multiplicity="(1 1)"
	 */
	private Context c;

	public MapMarker(Drawable defaultMarker, MapView mapView) {
		super(boundCenter(defaultMarker), mapView);
		c = mapView.getContext();
	}

	public void addOverlay(BalloonOverlayItem overlay) {
		mapoverlays.add(overlay);
		populate();
	}

	@Override
	protected BalloonOverlayItem createItem(int i) {
		return mapoverlays.get(i);
	}

	@Override
	public int size() {
		return mapoverlays.size();
	}

	@Override
	protected boolean onBalloonTap(int index) {
		Toast.makeText(c, "onBalloonTap for overlay index " + index,
				Toast.LENGTH_LONG).show();
		return true;
	}
}
